#ifndef TELEPORT_CONTROL_H__
#define TELEPORT_CONTROL_H__

class TeleportControl;

#include "PlayState.h"

typedef struct TeleportPair {
    OgreNewt::Body *body_1;
    Ogre::Vector3 dir_out_1;
    OgreNewt::Body *body_2;
    Ogre::Vector3 dir_out_2;
} TeleportPair;


class TeleportControl : public OgreNewt::ContactCallback
{
private:
    
    typedef std::map<int, TeleportPair> TeleportPairMap;
    
    OgreNewt::World *world;
    TeleportPairMap teleport_pairs;
    PlayState *play_state;
    Ogre::ParticleSystem *particle_system;
    
    Ogre::Real last_contact_time;
    bool currently_teleporting;
    
    //int userBegin();
    //int userProcess();
    
public:
    TeleportControl(OgreNewt::World *on);
    ~TeleportControl();
    
    void addTeleport(OgreNewt::Body *body, Ogre::SceneNode *n);
    void setPlayState(PlayState *ps) { play_state = ps; }
    void reset();
    TeleportControl *clone();  
	void finishedTeleporting();
	
	void ballCollision(OgreNewt::Body *teleport_body, OgreNewt::Body *ball_body);
        
} ; 


#endif
